package dao;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

import interfaces.IPlacar;
import model.Placar;

public class DaoPlacar extends DaoGenerico<Placar> implements IPlacar{
	
	
	@Override
	public Placar getPorId(Long id) {
		Session session = this.getSession();
		Criteria criteria = session.createCriteria(Placar.class);
		criteria.add(Restrictions.eq("id", id));
		Placar p = (Placar) criteria.uniqueResult();
		session.close();
		return p;
	}

	@Override
	public Placar getPlacarPorGol(String gol) {
		Session session = this.getSession();
		Criteria criteria = session.createCriteria(Placar.class);
		criteria.add(Restrictions.eq("gol", gol));
		Placar p = (Placar) criteria.uniqueResult();
		session.close();
		return p;
	}

	

}
